﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Framework.FluentTextStringBuilder;

namespace Framework
{
    public class TextStringBuilder : TextBuilder
    {
        #region C'tor
        public TextStringBuilder()
            : this("\r\n")
        {
        }
        public TextStringBuilder(int indent)
            : this("\r\n", "    ", ": ", 30, indent)
        {
        }
        public TextStringBuilder(string endOfLine)
            : this(endOfLine, "    ", ": ", 30, 0)
        {
        }
        public TextStringBuilder(string endOfLine, string tab, string nameValueSeperator, int nameValuePadding, int indent)
        {
            Buffer = new StringBuilder();

            Initialize(new StringWriter(Buffer), endOfLine, tab, nameValueSeperator, nameValuePadding, indent);
        }
        #endregion

        public StringBuilder Buffer { get; set; }

        #region ToString
        public override string ToString()
        {
            return Buffer.ToString();
        }
        #endregion

        public static ITextStringBuilderWriterFluent Fluent
        {
            get { return new TextStringBuilderFluent(); }
        }
    }
}
